export default class NativeDialog {
    private static instance: NativeDialog;

    public static getInstance() {
        if (!this.instance) {
            this.instance = new NativeDialog();
        }
        return this.instance;
    }

    private mNativeDialog: ApicloudModules['nativeDialog'];

    constructor() {
        this.mNativeDialog = api.require('nativeDialog')
        if (!this.mNativeDialog) {
            throw new Error('nativeDialog 模块没引入')
        }
    }

    /**
     * 打开页面
     */

    public openWin(url: string,name: string){
        this.mNativeDialog.openWin({url,name})
    }
    public openModal(url: string,name: string){
        this.mNativeDialog.openModal({url,name})
    }
    public closeModal(){
        this.mNativeDialog.closeModal({animated: false})
    }
}